<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Hash;
use DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class OrderController extends Controller
{

	//后台订单
	public function getList(Request $request)
	{
		$num = $request->input('num',5);
        //搜索分页
    	if($request->input('keywords')){
    		$order = DB::table('order')->where('ousername','like','%'.$request->input('keywords').'%')->paginate($num);
    	}else{
    		$order = DB::table('order')->paginate($num);
    	}
    	//提取当前请求的所有参数
    	$data = $request->all();
    	// echo '用户列表页';
    	return view('admin.order.list',['order'=>$order,'request'=>$data]);
		
	}

	//前台订单
	public function getOrder($id)
	{
		
		//查询数据
		$order = DB::table('scenic')->where('id',$id)->first();
		//显示页面
		return view('home.order.order',['order'=>$order]);
	}
	

	public function postPay(Request $request)
	{
		$id = $request->only('id');
		//根据id查询数据
		$pay = DB::table('scenic')->where('id',$id)->first();
		//显示页面
		return view('home/pay/pay',['pay'=>$pay]);
	}

}
